# 0
# global

# 1
# nonlocal

# 2
# 内部函数无法被调用

# 3
# 无法调用上级var变量

# 4
def funout():
    def funin():
        print('bingo')

    return funin()


funout()


# 5
def funout2():
    def funin2():
        print('bingo2')

    return funin2

funout2()()
obj2 = funout2()
obj2()


def funx():
    x = 5

    def funy():
        nonlocal x
        x += 1
        return x

    return funy
a = funx()
print(a())
print(a())
print(a())

b = funx()
print(b())
